---
layout: m1x_soap
title: Invoice Create
---

<h2><a name="sales_order_invoice.create-Module%3AMageSales"></a>Module: Mage_Sales</h2>


<h4><a name="sales_order_invoice.create-Resource%3Asalesorderinvoice"></a>Resource: sales_order_invoice</h4>

<p><b>Aliases</b>:</p>
<ul>
	<li>order_invoice</li>
</ul>


<h5><a name="sales_order_invoice.create-Method%3A"></a>Method:</h5>

<ul>
	<li>sales_order_invoice.create (SOAP V1)</li>
	<li>salesOrderInvoiceCreate (SOAP V2)</li>
</ul>


<p>Allows you to create a new invoice for an order.</p>

<p><b>Aliases</b>:</p>
<ul>
	<li>order_invoice.create</li>
</ul>



<p><b>Arguments</b>:</p>

<table><tbody>
<tr>
<th> Type </th>
<th> Name </th>
<th> Description </th>
</tr>
<tr>
<td> string </td>
<td> sessionId <br class="atl-forced-newline" /> </td>
<td> Session ID </td>
</tr>
<tr>
<td> string <br class="atl-forced-newline" /> </td>
<td> invoiceIncrementId <br class="atl-forced-newline" /> </td>
<td> Order increment ID </td>
</tr>
<tr>
<td> array </td>
<td> itemsQty <br class="atl-forced-newline" /> </td>
<td> Array of orderItemIdQty (quantity of items to invoice) </td>
</tr>
<tr>
<td> string <br class="atl-forced-newline" /> </td>
<td> comment <br class="atl-forced-newline" /> </td>
<td> Invoice comment (optional) </td>
</tr>
<tr>
<td> string <br class="atl-forced-newline" /> </td>
<td> email <br class="atl-forced-newline" /> </td>
<td> Send invoice on email (optional) </td>
</tr>
<tr>
<td> string <br class="atl-forced-newline" /> </td>
<td> includeComment <br class="atl-forced-newline" /> </td>
<td> Include comments in email (optional) </td>
</tr>
</tbody></table>


<p><b>Returns</b>:</p>

<table><tbody>
<tr>
<th> Type </th>
<th> Description </th>
</tr>
<tr>
<td> string </td>
<td> ID of the created invoice </td>
</tr>
</tbody></table>


<p>The <b>orderItemIdQty</b> content is as follows:</p>

<table><tbody>
<tr>
<th> Type </th>
<th> Name </th>
<th> Description </th>
</tr>
<tr>
<td> int </td>
<td> order_item_id <br class="atl-forced-newline" /> </td>
<td> Order item ID </td>
</tr>
<tr>
<td> double </td>
<td> qty <br class="atl-forced-newline" /> </td>
<td> Quantity </td>
</tr>
</tbody></table>


<h4><a name="sales_order_invoice.create-Examples"></a>Examples</h4>

<h5><a name="sales_order_invoice.create-RequestExampleSOAPV1"></a>Request Example SOAP V1</h5>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<div>
		<pre class="theme: Default; brush: php; gutter: false">$client = new SoapClient('http://magentohost/api/soap/?wsdl');

// If somestuff requires API authentication,
// then get a session token
$session = $client-&gt;login('apiUser', 'apiKey');

$result = $client-&gt;call(
    $session,
    'sales_order_invoice.create',
    array('orderIncrementId' =&gt; '200000008', array('15' =&gt; '1', '16' =&gt; '1')) 
    // orderItemIdQty Array is Keyed with Order Item ID, with Value of qty to invoice
);
var_dump ($result);

// If you don't need the session anymore
//$client-&gt;endSession($session);</pre>
		</div>
</div></div>

<h5><a name="sales_order_invoice.create-RequestExampleSOAPV2"></a>Request Example SOAP V2</h5>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<div>
		<pre class="theme: Default; brush: php; gutter: false">$proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
$sessionId = $proxy-&gt;login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary

//Create invoice for order

// orderItemIdQty Array is Keyed with Order Item ID, with Value of qty to invoice
$qty = array('15' =&gt; '1', '16' =&gt; '1');

$invoiceIncrementId = $proxy-&gt;salesOrderInvoiceCreate(
    $sessionID,
    '200000008',
    $qty
);
var_dump($invoiceIncrementId);</pre>
		</div>
</div></div>




<h5><a name="sales_order_invoice.create-RequestExampleSOAPV2%28WSIComplianceMode%29"></a>Request Example SOAP V2 (WS-I Compliance Mode)</h5>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<div>
		<pre class="theme: Default; brush: php; gutter: false">$proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');

$sessionId = $proxy-&gt;login((object)array('username' =&gt; 'apiUser', 'apiKey' =&gt; 'apiKey'));

$result = $proxy-&gt;salesOrderInvoiceCreate((object)array('sessionId' =&gt; $sessionId-&gt;result, 'orderIncrementId' =&gt; '200000008', 'itemsQty' =&gt; array('15' =&gt; '1',  '16' =&gt; '1'), 'comment' =&gt; null,
'email' =&gt; null,
'includeComment' =&gt; null
));
var_dump($result-&gt;result);</pre>
		</div>
</div></div>


